﻿<%@ Control Language="C#" Inherits="Web.Control.WWW.Wiki.Editors" %>
<div class="common">
	<div id="new_body">
		<div id="body_900">
			<div id="body_left"></div>
			<div id="body_main">
				<div class="submenuN">
					<div class="submenuN_position">
						<div class="submenuN_title">
							<div class="submenuN_Btitle">
								<h1><%=GetText("WK003")%></h1>
							</div>
							<div class="submenuN_button"><%if (((Lx.Web.Common.UI.TDTPageBase)Page).IsAffirm){%><a href="/knowledge/edit.htm" class="Naddbtn btnspec" style="text-decoration:none"><%}else{ %><a href="#" onclick="NotAffirm()" class="Naddbtn btnspec" style="text-decoration:none"><%} %><span><%=GetText("WK004")%></span></a></div>
						</div>
					</div>
				</div>
				<div class="Center9001n">
					<div class="Center9001Right">
						<div class="Center9001Content">
							<div class="knowedge_area">
								<h3><%=GetText("WK081")%></h3>
								<div class="margin20">
									<!--creator info-->
									<div style="width: 100px">
										<div class="pic90" style="width: 92px; margin: 0 auto"><a class="photo_90" href="/<%=Creator.Username %>.htm" title="<%=Creator.NickName%>"><%=(Creator.Image == "" ? "<img src=\"/Images/No_pic.gif\" />" : string.Format("<img src=\"{0}\" />", Creator.Image))%></a></div>
										<div style="width: 100px; overflow: hidden; white-space: nowrap; text-align: center"><img src='/Images/<%=(Creator.Online?"Online":"Offline")%>.gif' title='<%=(Creator.Online?GetText("C0038"):GetText("C0039"))%>' /> <a href='/<%=Creator.Username %>.htm'><%=Creator.NickName%></a><br />(<%=Creator.ConCreatores%>)</div>
									</div>
								</div>
								<h3><%=GetText("WK082")%></h3>
								<div class="margin20">
									<!--editor info-->
									<asp:Repeater ID="rptL" runat="server">
										<ItemTemplate>
											<div class="cenlist">
												<div class="pic50 cen50"><a class="photo_50" href="/<%#Eval("Username")%>.htm" title="<%#Eval("NickName")%>"><%#(Eval("Image").ToString() == "" ? "<img src=\"/Images/No_pic.gif\" />" : string.Format("<img src=\"{0}\" />", Eval("Image")))%></a></div>
												<div class="wid100"><img src='/Images/<%#((bool)Eval("Online")?"online":"offline")%>.gif' title='<%#((bool)Eval("Online")?GetText("C0038"):GetText("C0039"))%>' /> <a href='/<%#Eval("Username")%>.htm'><%#Eval("NickName")%></a><br />(<%#Eval("ConCreatores")%>)</div>
											</div>
										</ItemTemplate>
									</asp:Repeater>
									<div class="clear"></div>
								</div>
								<div>
									<%if(Page.User.Identity.Name!=""&&Page.User.Identity.Name!=Creator.Username){ %>
									<span id="RequestEdit"  <%=(((Lx.Web.Common.UI.TDTPageBase)Page).IsAffirm)?"onclick=\"RequestEdit()\"":"onclick=\"NotAffirm()\""%>><div class="floatl"><a href="javascript:void(0);" class="specbtn" style="text-decoration:none"><span>&nbsp;&nbsp;&nbsp;<%=GetText("WK045")%>&nbsp;&nbsp;&nbsp;</span></a></div><div class="clear"></div></span>
									<%} %>
								</div>
							</div>
						</div>
					</div>
					<div class="Center9001Left">
						<div class="right_layerA">
							<div class="layer_contentA">
								<h4><%=GetText("WK030")%></h4>
								<div class="layer_contentA5">
									<p><img src="/Images/language_<%=Learn%>.gif" align="absmiddle" /> <strong><%=GetText("C0105",new string[]{GetLanguageText(Learn)})%></strong><br /><img src="/Images/language_<%=BaseL%>.gif" align="absmiddle" /> <strong><%=GetText("C2019",new string[]{GetLanguageText(BaseL)})%></strong></p>
									<p>
										<strong><span id="RFen"><%=Rate.ToString("N2")%></span> <%=GetText("WK098")%></strong> (<span id="RRen"><%=SumVote%></span> <%=GetText("WK096")%>)
										<br />
										<div id="ThaiRating" onmouseout="RateOut()">
											<%for (int i = 0; i < Math.Round(Rate, 0); i++)
											  {%>
											<span id="ThaiRating_Star_<%=(i+1)%>" onmouseover="RateOver(<%=(i+1)%>)" onclick="RateClick(<%=(i+1)%>)"
												class="ratingStar filledRatingStar" style="float: left;">&nbsp;</span>
											<%} %>
											<%for (int i = (int)Math.Round(Rate, 0); i < 5; i++)
											  { %>
											<span id="Span1" onmouseover="RateOver(<%=(i+1)%>)" onclick="RateClick(<%=(i+1)%>)"
												class="ratingStar emptyRatingStar" style="float: left;">&nbsp;</span>
											<%} %>
										</div>
										<br />
										<strong><span id="viewCount"><%=ViewCount%></span> <%=GetText("WK097")%></strong></p>
								</div>
								<div class="margin5"><img src="/Images/icon_common_comment.gif" align="absmiddle" /> <a href="/knowledge/comment-1-<%=HttpUtility.UrlEncode(Request["n"])%>.htm"><%=GetText("C0111")%> (<span id="commentCount"><%=RecordCount%></span>)</a></div>
								<div class="margin5"><img src="/Images/icon_common_flag.gif" align="absmiddle" /> <a href="#"><%=GetText("WK034")%></a></div>
								<div class="margin5"><img src="/Images/icon_print.gif" align="absmiddle" /> <a href="#"><%=GetText("WK033")%></a></div>
								<div class="margin5">
									<script type="text/javascript">
				addthis_url = window.location.href;  
				addthis_title = "italki language exchange and learning community"; 
				addthis_pub = "italki.com";
				//document.getElementById("shareUrl").value = addthis_url;
									</script>
									<script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12"></script>
								</div>
							</div>
						</div>
						<div class="right_layerA">
							<div class="layer_contentA"><img src="/Images/icon_tips.gif" align="absmiddle" /> <strong><a href="/knowledge/wiki-How+to+edit+the+italki+wiki1.htm">How do I edit italki wiki?</a></strong>
							</div>
						</div>
					</div>
					<div class="clear"></div>
				</div>
			</div>
			<div id="body_right"></div>
			<div class="clear"></div>
		</div>
		<div id="body_900F"></div>
	</div>
</div>
<script>
var m = '<%=HttpContext.Current.User.Identity.Name%>';
var gRequest = false;
var sRequest = "<%=GetText("WK051")%>";
var sRateValue = <%=(int)Math.Round(Rate, 0) %>;
var RateValue = sRateValue;
var tmp = sRateValue;
function RateOver(value)
{
	RateValue = value;
	UpdateRate();
}
function RateOut()
{
	RateValue = sRateValue;
	UpdateRate();
}
function RateClick(value)
{
	tmp = sRateValue;
	sRateValue = value;
	RateValue = value;
	WebServices.knowledge.Rate('<%=Escape(Request["n"])%>',value,RateSucc,RateError);
}

function UpdateRate()
{
	for (var i = 1; i < 6; i++) 
	{
		var starElement=$get("ThaiRating_Star_"+i);
		if(starElement==null) return;
		if (RateValue > (i-1)) 
		{
			starElement.setAttribute("class","ratingStar filledRatingStar");
			starElement.setAttribute("className","ratingStar filledRatingStar");  
		}
		else 
		{
			starElement.setAttribute("class","ratingStar emptyRatingStar");
			starElement.setAttribute("className","ratingStar emptyRatingStar");
		}
	}
}
function RateSucc(result)
{
	if(result[0].State)
	{
		var obj1 = $get("ThaiRating");
		var obj2 = $get("RFen");
		var obj3 = $get("RRen");
		obj2.innerHTML = result[1];
		obj3.innerHTML = result[2];
		RateValue = result[3];
		var listBuilder = new Sys.StringBuilder();
		for (var index = 0; index < RateValue; ++index)
		{
			listBuilder.append('<span class="ratingStar savedRatingStar" style="float: left;">&nbsp;</span>');
		}
		for(var index=RateValue;index<5; ++index)
		{
			listBuilder.append('<span class="ratingStar emptyRatingStar" style="float: left;">&nbsp;</span>');
		}
		obj1.innerHTML = listBuilder.toString();
	}
	else
	{
		sRateValue = tmp;
		RateValue = sRateValue;
		UpdateRate();
	}
}
function RateError(result)
{
	sRateValue = tmp;
	RateValue = sRateValue;
	UpdateRate();
}
function RequestEdit()
{
	if(gRequest) return;
	if(m=="") window.location = "/user/login.htm?IsShow=1&ReturnUrl="+window.location.href;
	 $get("RequestEdit").disabled = true;
	showProgressBar(true); 
	WebServices.knowledge.RequestEdit('<%=Escape(Request["n"])%>',RequestSucc);
}
function RequestSucc(result)
{
	$get("RequestEdit").disabled = false;
	showProgressBar(false);
	if(result.State)
	{
		gRequest = true;
		$get("RequestEdit").innerHTML = sRequest;
	}
	else
	{
		if(result.Msg =="l") window.location = "/user/login.htm?IsShow=1&ReturnUrl="+window.location.href;
	}
}
</script>